import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm'

@Entity({
  name: 'user'
})
export class UserEntity {
  @PrimaryGeneratedColumn({
    type: 'int',
    name: 'id',
    comment: '主键id'
  })
  id: number

  @Column({
    type: 'varchar',
    nullable: true,
    unique: false,
    name: 'username',
    length: 64,
    comment: '用户姓名'
  })
  username: string

  @Column({
    type: 'int',
    nullable: true,
    unique: false,
    // length: 11,
    name: 'age',
    comment: '年龄'
  })
  age: number

  @Column({
    type: 'tinyint',
    default: () => 0,
    name: 'is_del',
    comment: '是否可删除，0-可以，1-不可以'
  })
  isDel: number

  // @Column({
  //   type: 'varchar',
  //   name: 'password',
  //   comment: '密码'
  // })
  // password: number

  @CreateDateColumn({
    type: 'timestamp',
    name: 'create_time',
    comment: '创建时间',
    unique: false,
    nullable: true,
  })
  createTime: Date

  @UpdateDateColumn({
    type: 'timestamp',
    name: 'update_time',
    comment: '更新时间',
    unique: false,
    nullable: true,
  })
  updateTime: Date
}